package 蓝桥真题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class 时间加法 {
	   static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       static int a,b,t;
       
       public static void main(String[] args) throws IOException {
		      a=Integer.parseInt(br.readLine());
		      b=Integer.parseInt(br.readLine());
		      t=Integer.parseInt(br.readLine());
		      int min=a*60+b+t;
		      a=min/60;
		      b=min%60;
		      System.out.println(a);
		      System.out.println(b);
		      
	}
}
